<template>
<div>
  <template>
    <el-table
        :data="tableData"
        style="width: 100%">
      <el-table-column prop="userTask.task.assignee" label="用户"></el-table-column>
<!--      <el-table-column prop="userTask.task.id" label="代办id"></el-table-column>-->
      <el-table-column prop="userTask.task.name" label="代办人"></el-table-column>
      <el-table-column prop="time" label="时间"></el-table-column>
      <el-table-column prop="apply.title+':'+apply.id" label="合同信息">
        <template slot-scope="scope">
            {{scope.row.apply.title}}|{{scope.row.apply.id}}|{{scope.row.apply.money}}
        </template>
      </el-table-column>
      <el-table-column  label="合同申请">
        <template slot-scope="scope">
          <el-button
              size="mini"
              @click="handleEdit(scope.row)">审核</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-dialog
        title="提示"
        :visible.sync="dialogVisible"
        width="50%">
      <el-form :inline="true" :model="vo" class="demo-form-inline">
        <el-form-item label="审核意见">
          <el-radio-group v-model="vo.auditFlag">
            <el-radio label="true" value="true">同意</el-radio>
            <el-radio label="false" value="false">驳回</el-radio>
          </el-radio-group>
        </el-form-item><br>
        <el-form-item label="审核批注">
          <el-input  v-model="vo.message" placeholder="审核批注"></el-input>
        </el-form-item><br>
        <el-form-item>
          <el-button type="primary" @click="check">审核</el-button>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
  </span>
    </el-dialog>
  </template>
</div>
</template>

<script>
export default {
  name: "List",
  data() {
    return {
      tableData: [],
      dialogVisible: false,
      vo:{}
    }
  },
  created() {
    this.initTable()
  },
  methods:{
    toLogin() {
      this.$router.push("/login")
    },
    check() {
      this.axios.post("http://localhost:81/apply/complete",this.vo).then(
          res=>{
            if (res.data.code === 200) {
              this.$message.success("申请审核成功")
              this.dialogVisible=false
              this.initTable()
            }
          }
      )
    },
    handleEdit(row) {
      this.dialogVisible = true
      this.vo.taskId=row.userTask.task.id
      this.vo.processInstanceId=row.userTask.task.processInstanceId
      console.log(row.task.id)

    },
    initTable() {
      this.axios.get("http://localhost:81/apply/query").then(
          res=>{
            this.tableData =res.data.data
          }
      )
    },
    handleSizeChange(val) {
      this.size =val
      this.initTable()
    },
    handleCurrentChange(val) {
      this.page =val
      this.initTable()
    }
  }
}
</script>

<style scoped>

</style>
